Skip to content

Conversation

@thomhurst
Copy link
Owner

Summary

  • Remove Discovered message loop from HandleRunRequestAsync during test execution
  • Only send Discovered messages during discovery requests (for test explorers)
  • Change DynamicTestQueue.EnqueueAsync to synchronous Enqueue method
  • Dynamic tests created at runtime don't need discovery notifications since they're created during execution

Rationale

Discovered messages are used by test explorers to populate their UI during test discovery. When actually running tests, these messages are unnecessary overhead since:

  1. The tests have already been discovered
  2. The test session is in execution mode, not discovery mode
  3. Dynamic tests (created via CreateTestVariant or AddDynamicTest) are created during execution, not discovery

Test plan

  • Build succeeds with no errors
  • Ran 10,218+ tests successfully
  • Verified discovery requests still send Discovered messages

🤖 Generated with Claude Code

- Remove Discovered message loop from HandleRunRequestAsync
- Only send Discovered messages during discovery requests
- Change DynamicTestQueue.EnqueueAsync to sync Enqueue
- Dynamic tests created at runtime don't need discovery notifications

This saves time and allocations when running tests since Discovered
messages are only needed for test explorer discovery, not execution.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@thomhurst
Copy link
Owner Author

Summary

Removes unnecessary Discovered message overhead during test execution by skipping these notifications when running tests (they remain for discovery requests).

Critical Issues

None found ✅

Suggestions

None - the change is clean and well-reasoned:

  • Discovery requests still send Discovered messages (TestRequestHandler.cs:48)
  • Run requests skip them to avoid redundant overhead
  • The async→sync change is safe (Channel.TryWrite is non-blocking for unbounded channels)
  • Internal API only (no public API changes, no snapshot updates needed)

Verdict

APPROVE - No critical issues

This is a solid performance optimization that removes unnecessary work during test execution while preserving correct behavior for test discovery.

@thomhurst thomhurst merged commit a0e1cc1 into main Jan 12, 2026
12 of 13 checks passed
@thomhurst thomhurst deleted the perf/skip-discovered-messages-during-execution branch January 12, 2026 01:00
This was referenced Jan 12, 2026
This was referenced Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants